Add a query to a query partition in the specified database.
URL Parameters | |
---|---|
format | The format of the data in the request body. Can be
either json , or xml . Use this parameter to override the
Content-type header. |
Upon success, MarkLogic server returns status code 201 (Created). If the payload is malformed or if the query already exists, a status code of 400 (Bad Request) is returned. A status code of 401 (Unauthorized) is returned if the user does not have the necessary privileges.
manage-admin
role, or the following
privilege: http://marklogic.com/xdmp/privileges/manage-admin
For more details, see Setting the Query Assignment Policy for the Query Partition in the Administrator's Guide.
The structure of the data in the request body is as follows:
partition-name
partition-number
upper-bound
lower-bound
forests-per-host
hosts
This is a complex structure with the following children:
host
replicas
data-directory
large-data-directory
fast-data-directory
options
This is a complex structure with the following children:
option
curl -X POST --anyauth -u admin:admin -H "Content-Type:application/xml" \ -d '<partition-query-properties xmlns="http://marklogic.com/manage/partition-query/properties"> <partition-number>2</partition-number> <query> <cts:or-query xmlns:cts="http://marklogic.com/cts"> <cts:word-query> <cts:text xml:lang="en">Manager</cts:text> </cts:word-query> <cts:word-query> <cts:text xml:lang="en">Engineer</cts:text> </cts:word-query> </cts:or-query> </query> </partition-query-properties>' \ http://gordon-1:8002/manage/v2/databases/Schemas/partition-queries
curl -X POST --anyauth --user admin:admin -H "Content-type: application/json" \ -d '{ "partition-number": 2, "query": { "orQuery": { "queries": [ { "wordQuery": { "text": [ "Manager" ], "options": [ "lang=en" ] } }, { "wordQuery": { "text": [ "Engineer" ], "options": [ "lang=en" ] } } ] } } }' \ http://gordon-1:8002/manage/v2/databases/Schemas/partition-queries